package com.zhongxiangspace.service.impl;

import com.zhongxiangspace.entity.Banner;
import com.zhongxiangspace.entity.QueryAnalyzer;
import com.zhongxiangspace.entity.VO.BannerVO;
import com.zhongxiangspace.mapper.BannerMapper;
import com.zhongxiangspace.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * banner
 */
@Service
public class BannerServiceImpl implements BannerService {

    @Autowired
    private BannerMapper bannerMapper;
    /**
     * 添加
     * @param banner
     * @return
     */
    @Override
    @Transactional
    public boolean insert(Banner banner) {
        return this.bannerMapper.insert(banner);
    }

    /**
     * 获取 data
     * @param queryAnalyzer 条件
     * @return
     */
    @Override
    public List<Banner> queryByKeyword(QueryAnalyzer queryAnalyzer) {
        return this.bannerMapper.queryByKeyword(queryAnalyzer);
    }

    /**
     * 获取data
     * @param id
     * @return
     */
    @Override
    @Transactional
    public boolean delete(String id) {
        return this.bannerMapper.delete(id);
    }

    /**
     * 修改状态
     * @param
     * @return
     */
    @Override
    @Transactional
    public boolean updataStatusCode(Banner banner) {
        return this.bannerMapper.updataStatusCode(banner);
    }

    /**
     * 获取单条数据
     * @param id
     * @return
     */
    @Override
    public Banner queryOne(String id) {
        return this.bannerMapper.queryOne(id);
    }

    /**
     * 修改
     * @param banner
     * @return
     */
    @Override
    @Transactional
    public boolean updata(Banner banner) {
        return this.bannerMapper.updata(banner);
    }

    /**
     *  条件查询
     * @param bannerQueryAnalyzer
     * @return
     */
    @Override
    public List<BannerVO> queryBannerVO(QueryAnalyzer bannerQueryAnalyzer) {
        return this.bannerMapper.queryBannerVO(bannerQueryAnalyzer);
    }
}
